package com.qf.mybatisplus.config.druid;

/**
 *  @author: ZDD
 *  @Date: 2022/2/14 11:08
 *  @Description:
 */
public class DatabaseContextHolder {
    private static final ThreadLocal<String> contextHolder = new ThreadLocal<>();
    //默认数据源
    public static final String DEFAULT_DS = "db1";
    public static final String SECOND_DS = "db2";
    public static final String THIRD_DS = "db3";

    public static void setDatabaseType(String type) {
        contextHolder.set(type);
    }

    public static String getDatabaseType() {
        return contextHolder.get();
    }

    public static void clearDataSource() {
        contextHolder.remove();
    }
}
